package com.eslserver.to.wrapper;

import java.io.File;

import com.eslserver.to.Image;
import com.eslserver.util.FileUploadUtil;

public class ImageWrapper {
	private Image image;
	private String name;
	private String downloadURL;
	private long size;

	private ImageWrapper(Image image) {
		this.image = image;
		File file = new File(image.getSystemPath());
		if (file.exists()) {
			this.name = file.getName();
			downloadURL = FileUploadUtil.GetDownloadURL(image.getSystemPath());
			size = file.length();
		}
	}

	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

	public Integer getImageID() {
		return image.getImageID();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDownloadURL() {
		return downloadURL;
	}

	public void setDownloadURL(String downloadURL) {
		this.downloadURL = downloadURL;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public static ImageWrapper createESLImageWrapper(Image image) {
		return new ImageWrapper(image);
	}
}
